# Maintainer: George Rawlinson <grawlinson@archlinux.org>
# Contributor: Felix Yan <felixonmars@archlinux.org>
# Contributor: Daniel Wallace <danielwallace at gtmanfred dot com>
# Contributor: Giovanni Scafora <giovanni@archlinux.org>

pkgname=python-beautifulsoup4
_pkgname="${pkgname#python-}"
pkgver=4.11.2
pkgrel=3
pkgdesc='A Python HTML/XML parser designed for quick turnaround projects like screen-scraping'
arch=('any')
url='https://www.crummy.com/software/BeautifulSoup/'
license=('MIT')
depends=('python-soupsieve')
optdepends=(
  'python-chardet: to autodetect character encodings'
  'python-lxml: alternative HTML parser'
  'python-html5lib: alternative HTML parser'
)
makedepends=(
  'python-build'
  'python-installer'
  'python-wheel'
  'python-setuptools'
)
checkdepends=('python-pytest')
source=("$pkgname-$pkgver.tar.gz::https://www.crummy.com/software/BeautifulSoup/bs4/download/${pkgver%.*}/$_pkgname-$pkgver.tar.gz")
sha512sums=('68f5328f881946e80ed1af36b26da184f0af58aaf124f5f623f89c40130e1578f6dbe874b11c802e52c0ec02cfbf6b681e10eb235279631f479d14c2243e7dd3')
b2sums=('19fc88dff84c398461ecce3b66b1a92c3541114e3595aa1bae7182914e174d9c36b6de37ba120200695f6dca489c6afcd361244ae9577bc469d20a0864989d48')

build() {
  cd "$_pkgname-$pkgver"

  python -m build --wheel --no-isolation
}

check() {
  cd "$_pkgname-$pkgver"

  pytest -v
}

package() {
  cd "$_pkgname-$pkgver"

  python -m installer --destdir="$pkgdir" dist/*.whl

  # license
  install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE
}
